﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.Common;
using DataAccessClasses;

namespace LotteryBO
{
    class Prize_Awads
    {
        iDAC dac = DACFactory.GetDAC();
        private long _player_id = -99;
        private long _prize = -99;
        private long _charity = -99;
        private int _tax = -99;
        private string _pay_mode = "";
        private bool _isdeleted = false;
       
        public bool isdeleted
        {
            get
            {
                return _isdeleted;
            }
            set
            {
                _isdeleted = value;
            }
        }
        public long player_id
        {
            get
            {
                return _player_id;
            }
            set
            {
                _player_id = value;
            }
        }
        public long prize
        {
            get
            {
                return _prize;
            }
            set
            {
               _prize = value;
            }
        }
        public long charity
        {
            get
            {
                return _charity;
            }
            set
            {
                _charity = value;
            }
        }
        public int tax
        {
            get
            {
                return _tax;
            }
            set
            {
                _tax = value;
            }
        }
        public string pay_mode
        {
            get
            {
                return _pay_mode;
            }
            set
            {
                _pay_mode = value;
            }
        }
        public long SaveRecords()
        {
            try
            {
                DbParameter dbparam0 = dac.Parameter("@player_id", player_id, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam1 = dac.Parameter("@prize", prize, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam2 = dac.Parameter("@charity",charity, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam3 = dac.Parameter("@tax", tax, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam4 = dac.Parameter("@pay_mode", pay_mode, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam5 = dac.Parameter("@isdeleted", isdeleted, DbType.Boolean, ParameterDirection.Input);

                DbParameter[] dbparamcall = new DbParameter[] { dbparam0, dbparam1, dbparam2, dbparam3, dbparam4,dbparam5 };
                return dac.Save("Prize_Awards_save", dbparamcall);
            }
            catch (Exception ex)
            {
                long Result = -99;
            }
            return -99;
        }
        public DataTable GetRecords(long player_id, long prize, long charity, long tax, string pay_mode,bool isdeleted, string andor)
        {
            try
            {
                DbParameter dbparam0 = dac.Parameter("@player_id", player_id, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam1 = dac.Parameter("@prize", prize, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam2 = dac.Parameter("@charity", charity, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam3 = dac.Parameter("@tax", tax, DbType.Int64, ParameterDirection.Input);
                DbParameter dbparam4 = dac.Parameter("@pay_mode", pay_mode, DbType.AnsiString, ParameterDirection.Input);
                DbParameter dbparam5 = dac.Parameter("@isdeleted", isdeleted, DbType.Boolean, ParameterDirection.Input);

                DbParameter[] dbparamcall = new DbParameter[] { dbparam0, dbparam1, dbparam2, dbparam3, dbparam4, dbparam5 };
                DataTable dt1 = dac.Select("Prize_Awards_get", dbparamcall);
                return dt1;
            }
            catch (Exception ex)
            {
                long Result = -99;
            }
            return null;
        }
       
    }
}
